Repository navigation
fix(bin): sync-models resolves deployed user config when run from the Nix store - #592
Conversation
… Nix store ROOT_DIR-relative resolution assumed a repo checkout; the home-manager unit runs the script as a lone store file, so ROOT_DIR became /nix and the config check failed with '/nix/.opencode/opencode.jsonc does not exist!'. Resolution order now: $OPENCODE_CONFIG_PATH override, then the repo-local config when it exists, then ~/.config/opencode/opencode.jsonc. Fixes #591
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea3537ddbb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const USER_CONFIG_PATH = path.join(HOME_DIR, '.config/opencode/opencode.jsonc'); | ||
| const OPENCODE_CONFIG_PATH = | ||
| process.env.OPENCODE_CONFIG_PATH || | ||
| (fs.existsSync(REPO_CONFIG_PATH) ? REPO_CONFIG_PATH : USER_CONFIG_PATH); |
There was a problem hiding this comment.
Package the policy with the deployed script
When this fallback is taken by the Home Manager service or installed CLI, ${../../bin/sync-models.mjs} is copied into the Nix store as a lone file, so the adjacent sync-models.policy.json still cannot be found. loadPolicy() therefore returns an empty policy, causing both Antigravity providers to retain stale entries and add every discovered model rather than only the newest models in the configured families. The deployed path should also resolve or package the policy before allowing the service to update the user config.
Useful? React with 👍 / 👎.
Fixes #591.
What
bin/sync-models.mjsresolved the opencode config aspath.join(ROOT_DIR, '.opencode/opencode.jsonc')withROOT_DIRderived from the script's own location. In a repo checkout that works; under the home-managersync-modelsservice the script is a lone Nix store file, soROOT_DIRresolved to/nixand every run died with:Resolution order now:
$OPENCODE_CONFIG_PATHenv override.opencode/opencode.jsoncwhen it exists (in-checkout behavior unchanged)~/.config/opencode/opencode.jsonc— the deployed user config the service maintains (same file theopencode-config-normalizepath unit watches)Verified
node --checkclean.Not verified / follow-up
POLICY_PATHhas the same store-layout quirk, but its loader already tolerates a missing policy file (empty defaults), so it is left as-is here.Need help on this PR? Tag
@codesmith-botwith what you need.